﻿<UserControl x:Class="SoftSource.Timecard.Views.EntriesPriorToProjectBillingDateView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:softsourceConverters="clr-namespace:SoftSource.Common.Converters;assembly=SoftSource.Common.Silverlight"
             xmlns:controlsToolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"
             xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data">

    <UserControl.Resources>
        <softsourceConverters:FormattedDateConverter x:Key="FormattedDateConverter" />
    </UserControl.Resources>

    <controlsToolkit:BusyIndicator x:Name="LoadIndicator"
                                   HorizontalContentAlignment="Stretch"
                                   VerticalContentAlignment="Stretch">
        <Grid x:Name="LayoutRoot">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition />
            </Grid.RowDefinitions>
            <ComboBox x:Name="ProjectsComboBox"
                      ItemsSource="{Binding Projects.Value}"
                      DisplayMemberPath="Name"
                      SelectionChanged="ProjectsComboBox_SelectionChanged"
                      Margin="0,4,0,4" />
            <data:DataGrid Grid.Row="1"
                           ItemsSource="{Binding Entries.Value, Mode=OneWay}"
                           AutoGenerateColumns="False"
                           IsReadOnly="True">
                <data:DataGrid.Columns>
                    <data:DataGridTextColumn Header="Name"
                                             Binding="{Binding UserID, Converter={StaticResource UserIDConverter}, ConverterParameter='FullName'}" />
                    <data:DataGridTextColumn Header="Category"
                                             Binding="{Binding CategoryID, Converter={StaticResource CategoryIDConverter}, ConverterParameter='Name'}" />
                    <data:DataGridTextColumn Header="Entry Date"
                                             Binding="{Binding EntryDate, Converter={StaticResource FormattedDateConverter}}" />
                </data:DataGrid.Columns>
            </data:DataGrid>
        </Grid>
    </controlsToolkit:BusyIndicator>
</UserControl>